home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef __OSUTILS__
- #include <OSUtils.h>
- #endif
-
- #ifndef __RESOURCES__
- #include <Resources.h>
- #endif
-
- #ifndef __EXCEPTIONS__
- #include <Exceptions.h>
- #endif
-
- #ifndef __MEMORY__
- #include <Memory.h>
- #endif
-
- #if __powerpc
-
- long gControlTrap;
- OSType gGestaltSelector;
-
- #define ShowINIT(x,y)
-
- #else
-
- #ifndef __GESTALTVALUE__
- #include <GestaltValue.h>
- #endif
- void MyControl(void);
- extern pascal void ShowINIT(short iconID, short moveX);
-
- #endif
-
- #ifndef __COMMON__
- #include "Common.h"
- #endif
-
-
- void INITInstall(void)
- {
- long oldControl;
- Handle theInitResource;
- OSType gestaltSelector;
- long gestaltInfo;
- OSErr error;
- Handle theStart;
-
- HLock(theStart = RecoverHandleSys((Ptr) INITInstall));
- DetachResource(theStart);
- oldControl = GetOSTrapAddress(0xA004);
- gestaltSelector = Initialize(&gestaltInfo);
- require(gestaltInfo, badinit);
-
- setGestalt(gestaltSelector);
- setTrap(oldControl);
-
- #if !__powerpc
- error = NewGestaltValue(gestaltSelector, gestaltInfo);
- nrequire(error, newgestaltval);
- #endif
-
- SetOSTrapAddress((UniversalProcPtr) MyControl, 0xA004);
-
- ShowINIT(kSuccessIcon, 40);
- return;
- newgestaltval:
- {
- MyGestaltPtr pb = (MyGestaltPtr) gestaltInfo;
- OriginalLinkPtr thePtr, pd;
-
- if (gestaltInfo)
- {
- pd = pb->trappedNames;
- while (thePtr = pd->next)
- {
- DisposePtr((Ptr) pd);
- }
- DisposePtr((Ptr) pd);
-
- DisposePtr((Ptr) pb->registeredNames);
- DisposePtr((Ptr) pb);
- }
- }
- badinit:
- HUnlock(theStart);
- HPurge(theStart);
- ShowINIT(kFailureIcon, 40);
- }